package com.ad.pet.message.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.models.remote.message.Record;

import java.util.List;

/**
 * Created by SEELE on 2019/7/3.
 */

public class RecordListAdapter extends BaseQuickAdapter<Record,BaseViewHolder> {
    public RecordListAdapter( @Nullable List<Record> data) {
        super(R.layout.item_record_list_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Record item) {

        TextView tvTitle = helper.getView(R.id.tv_title);
        TextView tvPrice = helper.getView(R.id.tv_order_price);
        TextView tvTime = helper.getView(R.id.tv_time);
        TextView tvOrderNumber = helper.getView(R.id.tv_order_number);

        tvTitle.setText(item.getTitle());
        if (item.getAmount().indexOf("+")==0){
            tvPrice.setTextColor(mContext.getResources().getColor(R.color.black3d));
        }else {
            tvPrice.setTextColor(mContext.getResources().getColor(R.color.ios_button));
        }
        tvTime.setText(item.getAddtime());
        tvOrderNumber.setText(item.getOrder_sn());
        tvPrice.setText(item.getAmount());
    }
}
